package cn.pms.bo;

import java.util.List;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import cn.pms.po.Employee;
import devil.bo.BaseSpringSupportHibernateBo;

@Service
@Transactional
@Scope(value = "prototype")
public class LoginBo extends BaseSpringSupportHibernateBo
{
	@Transactional(readOnly = true)
	public Employee login(Employee emp)
	{
		List<?> result = dao.findByExample(emp);
		if(result.size() > 0)
		{
			return (Employee) result.get(0);
		}
		else
		{
			return null;
		}
	}
	
	@Transactional(propagation = Propagation.REQUIRED)
	public Employee save(Employee dep)
	{
		return (Employee) dao.save(dep);
	}
}
